package com.group01.validation;

import com.group01.annotation.Flag;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @Description
 * @Author 翟玉龙
 * @Date 2024/5/16
 */
public class FlagValidation implements ConstraintValidator<Flag, String> {


    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if(value == null || value.isEmpty()) {
            return false;
        }
        return value.equals("0") || value.equals("1"); // 01 校验
    }
}
